import * as THREE from 'three';

// 鼠标跟随
class cursorMark {
  constructor(data, option) {
    this.data = data;
    this.option = option;
    this.context = option.context;
    this.childrenGroup = option.childrenGroup;
    this.config = data.configuration.cursorMark;
    this.interaction = data.configuration.interaction;
    this.srcLnglatToWorld = option.srcLnglatToWorld;
    this.data = data.data;
    this.onRelative = option.onRelative;
    this.currentIndex = 0;
    var a = r.config.baseConfig;
    this.showGroup = new THREE.Group();
    // this.showGroup.visible = false,
    this.defaultGroup = new THREE.Group();
    this.defaultGroup.position.y = a.height;
    this.currentGroup = new y.Group();
    this.currentGroup.position.y = a.height;
    this.currentGroup.visible = !1;
    this.showGroup.add(this.option.defaultGroup);
    this.showGroup.add(r.currentGroup);
    this.childrenGroup.add(r.showGroup);
    this.initMaterial();
    this.showData();
    this.initCurrentData();
    if (option.showLevel <= 0) {
      this.showCurrent(this.currentIndex);
      this.startCarousel();
    }
    return this.showGroup;
  }
  initMaterial() {
    var e = this.config;
    var t = e.currentConfig;
    var n = e.defaultConfig;
    var i = document.createElement('video', {
      muted: true,
      preload: 'auto',
      loop: true,
      autoPlay: true,
      controls: true,
      crossOrigin: 'anonymous',
      src: t.markConfig.video
    });
    i.addEventListener('canplay', e => {
      e.target.play();
    });
    var r = new THREE.VideoTexture(i);
    this.currentPlaneMaterial = new THREE.ShaderMaterial({
      uniforms: {
        color: {
          type: 'c',
          value: new THREE.Color('#f00')
        },
        texture: {
          value: r
        }
      },
      vertexShader: Gn.d,
      fragmentShader: Gn.c,
      blending: y.AdditiveBlending,
      depthWrite: false,
      transparent: true
    });
    this.currentBarMaterial = new y.MeshBasicMaterial({
      color: new THREE.Color('#f00'),
      blending: THREE.AdditiveBlending,
      transparent: !0,
      side: THREE.DoubleSide,
      map: this.textureMgr.get(t.barConfig.image)
    });
    this.defaultPlaneMaterial = new THREE.ShaderMaterial({
      uniforms: {
        color: {
          type: 'c',
          value: new THREE.Color(markConfig.color)
        },
        texture: {
          value: this.textureMgr.get(n.markConfig.image)
        }
      },
      vertexShader: Gn.d,
      fragmentShader: Gn.c,
      blending: y.AdditiveBlending,
      transparent: !0,
      depthWrite: !1
    });
    this.defaultBarMaterial = new y.MeshBasicMaterial({
      color: new y.Color().setStyle(n.barConfig.color.toLocaleLowerCase()),
      blending: y.AdditiveBlending,
      transparent: !0,
      depthWrite: !1,
      side: y.DoubleSide,
      map: this.textureMgr.get(n.barConfig.image)
    });
  }
  showData() {
    var e = this,
      t = this.config,
      n = t.defaultConfig,
      i = t.baseConfig.renderOrder;
    this.defaultGroup &&
      (Object(On.deepDisposeGroupGeometry)(this.defaultGroup), (this.defaultGroup.children = [])),
      this.data.length <= 0 ? (this.currentGroup.children = []) : this.initCurrentData(),
      this.data &&
        this.data.forEach(function (t, r) {
          var a = e.srcLnglatToWorld([t.lng, t.lat]),
            s = new y.Group();
          (s.userData = o(
            o({}, t),
            {},
            {
              _mapPosition: a
            }
          )),
            e.defaultGroup.add(s),
            (s.position.x = a.x),
            (s.position.z = -a.y);
          var l = new y.PlaneGeometry(n.markConfig.size, n.markConfig.size),
            u = new y.Mesh(l, e.defaultPlaneMaterial);
          u.rotateX(-Math.PI / 2), (u.renderOrder = i), s.add(u);
          var c = new y.Group();
          s.add(c);
          var h = new y.PlaneGeometry(n.barConfig.width, n.barConfig.height),
            p = new y.Mesh(h, e.defaultBarMaterial);
          (p.position.y = n.barConfig.height / 2), (p.renderOrder = i), c.add(p);
          var d = new y.Mesh(h, e.defaultBarMaterial);
          d.rotateY(Math.PI / 2),
            (d.position.y = n.barConfig.height / 2),
            (d.renderOrder = i),
            c.add(d);
        });
  }
  initCurrentData() {
    this.currentGroup &&
      (Object(On.deepDisposeGroupGeometry)(this.currentGroup), (this.currentGroup.children = []));
    var e = this.config,
      t = e.currentConfig,
      n = e.baseConfig.renderOrder,
      i = new y.PlaneGeometry(t.markConfig.size, t.markConfig.size),
      r = new y.Mesh(i, this.currentPlaneMaterial);
    r.rotateX(-Math.PI / 2), (r.renderOrder = n), this.currentGroup.add(r);
    var a = new y.Group();
    this.currentGroup.add(a);
    var o = new y.PlaneGeometry(t.barConfig.width, t.barConfig.height),
      s = new y.Mesh(o, this.currentBarMaterial);
    (s.position.y = t.barConfig.height / 2), (s.renderOrder = n), a.add(s);
    var l = new y.Mesh(o, this.currentBarMaterial);
    l.rotateY(Math.PI / 2), (l.position.y = t.barConfig.height / 2), (l.renderOrder = n), a.add(l);
  }
  showCurrent(e) {
    if (this.defaultGroup && this.defaultGroup.children) {
      var t = this.defaultGroup.children[e];
      t &&
        ((t.visible = !1),
        (this.currentGroup.position.x = t.userData._mapPosition.x),
        (this.currentGroup.position.z = -t.userData._mapPosition.y),
        (this.currentGroup.visible = !0),
        this.onRelativeAction(this.defaultGroup.children[e].userData));
    }
  }
  startCarousel() {
    var e = this,
      t = this.config.carouselConfig;
    if ((this.stopCarousel(), t.support))
      this.showCurrent(this.currentIndex),
        (this.interval = setInterval(function () {
          var t = e.defaultGroup.children[e.currentIndex];
          t && (t.visible = !0),
            (e.currentIndex = e.currentIndex + 1),
            e.currentIndex >= e.defaultGroup.children.length && (e.currentIndex = 0),
            e.showCurrent(e.currentIndex);
        }, 1e3 * t.time));
    else if (this.defaultGroup) {
      this.defaultGroup.traverse(function (e) {
        e.visible = !0;
      });
      for (var n = 0, i = this.defaultGroup.children.length; n < i; n++) {
        var r = this.defaultGroup.children[n];
        if (r && r.userData && r.userData.state) {
          (this.currentIndex = n), this.showCurrent(n);
          break;
        }
      }
    }
  }
  stopCarousel() {
    this.interval && clearInterval(this.interval);
  }
  updateComponent(e, t) {
    var n = this.config,
      i = n.baseConfig,
      r = (n.carouselConfig, n.currentConfig),
      a = n.defaultConfig,
      o = this.data;
    (this.config = e.configuration.cursorMark), (this.data = e.data);
    var s = this.config,
      l = s.baseConfig,
      u = s.carouselConfig,
      c = s.currentConfig,
      h = s.defaultConfig;
    if (
      ((this.defaultGroup.position.y = l.height),
      (this.currentGroup.position.y = l.height),
      i.showLevel !== l.showLevel && this.updateMapLevel(),
      a.markConfig.color !== h.markConfig.color &&
        (this.defaultPlaneMaterial.uniforms.color.value = new y.Color().setStyle(
          h.markConfig.color.toLocaleLowerCase()
        )),
      a.barConfig.color !== h.barConfig.color &&
        (this.defaultBarMaterial.color = new y.Color().setStyle(
          h.barConfig.color.toLocaleLowerCase()
        )),
      r.markConfig.color !== c.markConfig.color &&
        (this.currentPlaneMaterial.uniforms.color.value = new y.Color().setStyle(
          c.markConfig.color.toLocaleLowerCase()
        )),
      r.barConfig.color !== c.barConfig.color &&
        (this.currentBarMaterial.color = new y.Color().setStyle(
          c.barConfig.color.toLocaleLowerCase()
        )),
      (Object(x.isEqual)(o, this.data) &&
        a.markConfig.size === h.markConfig.size &&
        a.barConfig.width === h.barConfig.width &&
        a.barConfig.height === h.barConfig.height) ||
        this.showData(),
      (r.markConfig.size === c.markConfig.size &&
        r.barConfig.width === c.barConfig.width &&
        r.barConfig.height === c.barConfig.height) ||
        this.initCurrentData(),
      u.support)
    )
      this.currentIndex >= this.data.length && (this.currentIndex = 0), this.startCarousel();
    else {
      this.stopCarousel(),
        (this.currentGroup.visible = !1),
        this.defaultGroup.traverse(function (e) {
          e.visible = !0;
        });
      for (var p = 0, d = this.defaultGroup.children.length; p < d; p++) {
        var f = this.defaultGroup.children[p];
        if (f && f.userData && f.userData.state) {
          (this.currentIndex = p), this.showCurrent(p);
          break;
        }
      }
    }
  }
  updateMapLevel() {
    -1 == this.config.baseConfig.showLevel ||
    (this.context.isSub && 1 == this.config.baseConfig.showLevel) ||
    (!this.context.isSub && 0 == this.config.baseConfig.showLevel)
      ? (this.showGroup.visible = !0)
      : (this.showGroup.visible = !1);
  }
  onRelativeAction(e) {
    var t = this.interaction.callback,
      n = {};
    for (var i in t) {
      var r = t[i],
        a = r.target,
        o = r.origin;
      void 0 !== e[o] && (n[a] = e[o]);
    }
    this.onRelative(n);
  }
  destroy() {
    this.stopCarousel(),
      this.childrenGroup.remove(this.showGroup),
      Object(On.deepDisposeGroupGeometry)(this.showGroup),
      this.currentBarMaterial.map && this.currentBarMaterial.map.dispose(),
      this.currentBarMaterial.dispose(),
      (this.currentBarMaterial = null),
      this.currentPlaneMaterial.uniforms.texture &&
        this.currentPlaneMaterial.uniforms.texture.value.dispose(),
      this.currentPlaneMaterial.dispose(),
      (this.currentPlaneMaterial = null),
      this.defaultBarMaterial.map && this.defaultBarMaterial.map.dispose(),
      this.defaultBarMaterial.dispose(),
      (this.defaultBarMaterial = null),
      this.defaultPlaneMaterial.uniforms.texture.value &&
        this.defaultPlaneMaterial.uniforms.texture.value.dispose(),
      this.defaultPlaneMaterial.dispose(),
      (this.defaultPlaneMaterial = null),
      (this.showGroup = null),
      (this.data = null);
  }
}
class lightBar {
  constructor(e, i) {
    var r;
    Object(c.a)(this, n),
      (r = t.call(this, e)),
      console.log(arguments),
      (r.childrenGroup = i.childrenGroup),
      (r.config = e.configuration.lightBar),
      (r.interaction = e.configuration.interaction),
      (r.srcLnglatToWorld = i.srcLnglatToWorld),
      (r.data = e.data),
      (r.id = e.id),
      (r.container = i.mapContainer),
      (r.camera = i.camera),
      (r.lightBars = []),
      (r.selectedBar = null),
      (r.lastBar = null),
      (r.planes = []),
      (r.parentProps = i.parentProps),
      (r.context = i.context),
      (r.raycaster = new y.Raycaster()),
      (r.appearTween = null),
      (r.animState = 0),
      (r.currentLevel = 0);
    var a = r.config.heightConfig.baseHeight;
    return (
      (r.barGroup = new y.Group()),
      (r.barGroup.name = 'barGroup'),
      r.barGroup.layers.enable(1),
      (r.barGroup.position.y = a),
      r.childrenGroup.add(r.barGroup),
      r.showData(),
      (r.handleMouseMove = r.handleMouseMove.bind(Object(p.a)(r))),
      r.container.addEventListener('mousemove', r.handleMouseMove, !1),
      r.refreshVisible(),
      r
    );
  }
  refreshVisible() {
    var e = this.config.baseConfig.showLevel;
    -1 != e && ((this.context.isSub && 0 === e) || (!this.context.isSub && 1 == e))
      ? (this.barGroup.visible = !1)
      : (this.barGroup.visible = !0);
  }
  getMatColor(e) {
    function t(e) {
      return 0 == Object(Rn.converColor)(e).a
        ? (((e = new y.Color().setStyle(e.toLocaleLowerCase())).a = 0), e)
        : Object(Rn.converColor)(e);
    }
    var n = t(e.color),
      i = n.r,
      r = n.g,
      a = n.b,
      o = n.a,
      s = t(e.colors.end),
      l = s.r,
      u = s.g,
      c = s.b,
      h = s.a,
      p = t(e.colors.start),
      d = p.r,
      f = p.g,
      m = p.b,
      g = p.a;
    return {
      bottomColor: 'gradient' == e.fillType ? new y.Color(l, u, c) : new y.Color(i, r, a),
      bottomOpacity: 'gradient' == e.fillType ? h : o,
      topColor: 'gradient' == e.fillType ? new y.Color(d, f, m) : new y.Color(i, r, a),
      topOpacity: 'gradient' == e.fillType ? g : o
    };
  }
  initMaterial() {
    var e = this.config.barConfig.barType,
      t = this.getMatColor(this.config.barConfig.color),
      n = t.bottomColor,
      i = t.bottomOpacity,
      r = t.topColor,
      a = t.topOpacity,
      o = new y.ShaderMaterial({
        uniforms: y.UniformsUtils.merge([
          y.ShaderLib.phong.uniforms,
          {
            bottomColor: {
              type: 'c',
              value: n
            },
            topColor: {
              type: 'c',
              value: r
            },
            bottomOpacity: {
              type: 'f',
              value: i
            },
            topOpacity: {
              type: 'f',
              value: a
            },
            opacity: {
              type: 'f',
              value: a
            }
          }
        ]),
        vertexShader:
          '\n    #define PHONG\n    varying vec3 vViewPosition;\n    #ifndef FLAT_SHADED\n      varying vec3 vNormal;\n    #endif\n    #include <common>\n    #include <uv_pars_vertex>\n    #include <uv2_pars_vertex>\n    #include <displacementmap_pars_vertex>\n    #include <envmap_pars_vertex>\n    #include <color_pars_vertex>\n    #include <fog_pars_vertex>\n    #include <morphtarget_pars_vertex>\n    #include <skinning_pars_vertex>\n    #include <shadowmap_pars_vertex>\n    #include <logdepthbuf_pars_vertex>\n    #include <clipping_planes_pars_vertex>\n    varying vec2 vUv;\n    void main() {\n      vUv = uv;\n      #include <uv_vertex>\n      #include <uv2_vertex>\n      #include <color_vertex>\n    \n      #include <beginnormal_vertex>\n      #include <morphnormal_vertex>\n      #include <skinbase_vertex>\n      #include <skinnormal_vertex>\n      #include <defaultnormal_vertex>\n    #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n      vNormal = normalize( transformedNormal );\n    #endif\n      #include <begin_vertex>\n      #include <morphtarget_vertex>\n      #include <skinning_vertex>\n      #include <displacementmap_vertex>\n      #include <project_vertex>\n      #include <logdepthbuf_vertex>\n      #include <clipping_planes_vertex>\n    \n      vViewPosition = - mvPosition.xyz;\n    \n      #include <worldpos_vertex>\n      #include <envmap_vertex>\n      #include <shadowmap_vertex>\n      #include <fog_vertex>\n    }\n      ',
        fragmentShader:
          '\n    #define PHONG\n    uniform vec3 diffuse;\n    uniform vec3 emissive;\n    uniform vec3 specular;\n    uniform float shininess;\n    uniform float opacity;\n    #include <common>\n    #include <packing>\n    #include <dithering_pars_fragment>\n    #include <color_pars_fragment>\n    #include <uv_pars_fragment>\n    #include <uv2_pars_fragment>\n    #include <map_pars_fragment>\n    #include <alphamap_pars_fragment>\n    #include <aomap_pars_fragment>\n    #include <lightmap_pars_fragment>\n    #include <emissivemap_pars_fragment>\n    #include <envmap_pars_fragment>\n    #include <gradientmap_pars_fragment>\n    #include <fog_pars_fragment>\n    #include <bsdfs>\n    #include <lights_pars_begin>\n    //#include <lights_pars_maps>\n    #include <lights_phong_pars_fragment>\n    #include <shadowmap_pars_fragment>\n    #include <bumpmap_pars_fragment>\n    #include <normalmap_pars_fragment>\n    #include <specularmap_pars_fragment>\n    #include <logdepthbuf_pars_fragment>\n    #include <clipping_planes_pars_fragment>\n\n    uniform vec3 bottomColor;\n    uniform vec3 topColor;\n    uniform float bottomOpacity;\n    uniform float topOpacity;\n    uniform vec3 color;\n    varying vec2 vUv;\n   \n    void main() {\n\n      #include <clipping_planes_fragment>\n\n      vec4 diffuseColor = vec4( diffuse, opacity );\n      ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n      vec3 totalEmissiveRadiance = emissive;\n    \n      #include <logdepthbuf_fragment>\n      #include <map_fragment>\n      #include <color_fragment>\n      #include <alphamap_fragment>\n      #include <alphatest_fragment>\n      #include <specularmap_fragment>\n      #include <normal_fragment_begin>\n      #include <normal_fragment_maps>\n      #include <emissivemap_fragment>\n    \n      // accumulation\n      #include <lights_phong_fragment>\n      #include <lights_fragment_begin>\n      #include <lights_fragment_maps>\n      #include <lights_fragment_end>\n    \n      // modulation\n      #include <aomap_fragment>\n    \n      vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n    \n      #include <envmap_fragment>\n    \n      //gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n    \n     \n      gl_FragColor = vec4(mix(bottomColor, topColor, vUv.y) * outgoingLight, mix(bottomOpacity, topOpacity, vUv.y));\n      #include <tonemapping_fragment>\n      #include <encodings_fragment>\n      #include <fog_fragment>\n      #include <premultiplied_alpha_fragment>\n      #include <dithering_fragment>\n    }\n      ',
        transparent: !0,
        depthTest: !1
      });
    o.lights = !0;
    var s = new y.MeshPhongMaterial({
      color: r,
      transparent: !0,
      opacity: a,
      depthTest: !1
    });
    return 'rect' == e ? [o, o, s, o, o, o] : [o, s, o];
  }
  initBar(e, t, n, i, r, a) {
    (n *= r), (i *= a);
    var o = null;
    o =
      'rect' == e
        ? new y.BoxBufferGeometry(n / 2, i, n / 2, 50)
        : new y.CylinderBufferGeometry(n, n, i, 50, 20);
    var s = new y.Mesh(o, t);
    return (
      s.layers.enable(1),
      (s.rotation.y = Math.PI / 4),
      (s.renderOrder = 2e3),
      (s.userData.visible = !0),
      (s.userData.enlarged = !1),
      (s.userData.height = i),
      (s.userData.baseHeight = i / 2),
      (s.position.y = i / 2),
      s
    );
  }
  showData() {
    var e = this.config.barConfig,
      t = e.scaleR,
      n = e.scaleY,
      i = e.size,
      r = e.barType,
      a = e.maxHeight;
    if (((this.planes = []), this.data)) {
      for (var o = 0, s = 0; s < this.data.length; s++)
        +this.data[s].count > o && (o = +this.data[s].count);
      var l = a.show ? o / a.height : 1;
      this.barGroup.children = [];
      for (var u = 0; u < this.data.length; u++) {
        var c = this.data[u],
          h = this.srcLnglatToWorld([c.lng, c.lat]),
          p = this.initMaterial(),
          d = this.initBar(r, p, i, c.count / l, t, n);
        (d.position.x = h.x),
          (d.position.z = -h.y),
          Object.assign(d.userData, c, {
            index: u + 1
          }),
          this.barGroup.add(d),
          this.lightBars.push(d);
      }
      this.lightBars = this.lightBars.sort(function (e, t) {
        return t.userData.height - e.userData.height;
      });
    }
    this.barGroup.scale.set(1, 0, 1), this.barAppearAnim();
  }
  barAppearAnim() {
    var e = this,
      t = this.config.barConfig.raiseTime;
    null !== this.appearTween &&
      (cancelAnimationFrame(this.appearTween), (this.appearTween = null)),
      (this.animState = 1),
      (this.appearTween = _n({
        from: {
          scale: 0
        },
        to: {
          scale: 1
        },
        ease: i.easeInOut,
        duration: 1e3 * t
      }).start({
        update: function (t) {
          e.barGroup.scale.set(1, t.scale, 1);
        },
        complete: function () {
          if (((e.animState = 0), e.barGroup.visible))
            for (var t = 0; t < e.lightBars.length; t++) {
              var n = e.lightBars[t];
              e.initPlane(n, t + 1);
            }
        }
      }));
  }
  initPlane(e, t) {
    this.config.textConfig.order.isBgImg ? this.getImgBgDiv(e, t) : this.getSelfDesignDiv(e, t);
  }
  getImgBgDiv(e, t) {
    var n = this,
      i = this.config,
      r = i.textConfig,
      a = i.titleScale,
      o = i.baseConfig,
      s = a.max - (t * (a.max - a.min)) / this.lightBars.length,
      l = r.area,
      u = l.areaWidth,
      c = l.areaHeight,
      h = l.areaBgColor,
      p = l.areaOffsetLeft,
      d = l.areaOffsetTop,
      f = r.suffix,
      m = f.suffixContent,
      g = f.suffixFont,
      v = f.suffixTranslate,
      _ = r.order,
      b = _.orderOffsetHorizontal,
      x = _.orderOffsetVertical,
      w = _.isLeftOffset,
      M = _.isTopOffset,
      S = _.orderBoxWidth,
      T = _.orderBoxHeight,
      A = _.orderTextFontFamily,
      E = _.orderTextFontSize,
      L = _.orderTextColor,
      C = w ? b + p + 'px' : 'auto',
      P = w ? 'auto' : b + p + 'px',
      N = M ? x + d + 'px' : 'auto',
      O = M ? 'auto' : x + d + 'px',
      F = r.order.bgImg,
      R = r.count,
      I = R.isLeftOffset,
      D = R.isTopOffset,
      G = R.countOffsetHorizontal,
      U = R.countOffsetVertical,
      B = R.countBorderWidth,
      j = R.countBorderRadius,
      z = R.countWrapWidth,
      k = R.countWrapHeight,
      H = R.countFontFamily,
      V = R.countFontSize,
      W = R.countTextColor,
      X = R.countBorderColor,
      Y = R.countBackgroundColor,
      q = R.countDotCount,
      Q = I ? G + p + 'px' : 'auto',
      Z = I ? 'auto' : G + p + 'px',
      J = D ? U + d + 'px' : 'auto',
      $ = D ? 'auto' : U + d + 'px',
      K = r.address,
      ee = K.addFontFamily,
      te = K.addOffsetHorizontal,
      ne = K.addOffsetVertical,
      ie = K.isLeftOffset,
      re = K.isTopOffset,
      ae = K.addWrapWidth,
      oe = K.addFontSize,
      se = K.addColor,
      le = ie ? te + 'px' : 'auto',
      ue = ie ? 'auto' : te + 'px',
      ce = re ? ne + 'px' : 'auto',
      he = re ? 'auto' : ne + 'px',
      pe = document.createElement('div'),
      de = document.createElement('div');
    pe.appendChild(de),
      this.planes.push(pe),
      (de.style.background = h),
      (de.style.transformOrigin = 'center bottom'),
      (de.style.height = c + 'px'),
      (de.style.width = u + 'px'),
      (de.style.transform = 'translate(-50%,-100%) scale('.concat(s, ') ')),
      (de.style.position = 'absolute'),
      (de.style.pointerEvents = de.addEventListener('click', function (t) {
        n.onSelect(e.userData), t.stopPropagation();
      })),
      (de.innerHTML = '\n        <div style="\n        position: absolute;\n        left:'
        .concat(C, ';\n        right:')
        .concat(P, ';\n        top:')
        .concat(N, ';\n        bottom:')
        .concat(O, ';\n        width: ')
        .concat(S, 'px;\n        height: ')
        .concat(
          T,
          'px;\n        display: flex;\n        justify-content: center;\n        align-items: center;\n        font-family: '
        )
        .concat(A, ';\n        font-size: ')
        .concat(E, 'px;\n        color: ')
        .concat(L, ';\n        background-image: url(')
        .concat(window.appConfig.ASSETS_URL)
        .concat(F, ');\n        background-size: 100% 100%;\n        ">\n          ')
        .concat(
          t,
          '\n        </div>\n        \n        <div style="\n          position: absolute;\n          left:'
        )
        .concat(Q, ';\n          right:')
        .concat(Z, ';\n          top:')
        .concat(J, ';\n          bottom:')
        .concat(
          $,
          ';\n          display: flex;\n          align-items: center;\n          justify-content: center;\n\n          border:'
        )
        .concat(B, 'px solid ')
        .concat(X, ';\n          border-radius: ')
        .concat(j, 'px;\n          font-family: ')
        .concat(H, ';\n          font-size: ')
        .concat(V, 'px;\n          color: ')
        .concat(W, ';\n          width: ')
        .concat(z, 'px;\n          height: ')
        .concat(
          k,
          'px;\n          text-align: center;\n          padding: 5px;\n          background: '
        )
        .concat(Y, ';\n          ">\n          <span>')
        .concat(
          Number(e.userData.count).toFixed(q),
          '</span>\n          <span style="\n          font-family: '
        )
        .concat(g.suffixFontFamily, ';\n          font-size: ')
        .concat(g.suffixFontSize, 'px;\n          margin-left: ')
        .concat(v.x, 'px;\n          color: ')
        .concat(g.suffixColor, ';\n          ">')
        .concat(
          m,
          '</span>\n          \n        </div>\n\n        <div style="\n          text-align: center;\n          width: '
        )
        .concat(ae, 'px;\n          position: absolute;\n          left:')
        .concat(le, ';\n          right:')
        .concat(ue, ';\n          top:')
        .concat(ce, ';\n          bottom:')
        .concat(he, ';\n          font-family:')
        .concat(ee, ';font-size:')
        .concat(oe, 'px;color:')
        .concat(se, '">')
        .concat(e.userData.add, '\n        </div>')),
      (this.laberDiv = pe),
      (pe.style.pointerEvents = o.mouseEvent ? 'auto' : 'none');
    var fe = new y.CSS2DObject(pe);
    (fe.position.y = e.userData.height / 2),
      (e.userData.plane = fe),
      'slider' == o.actionWay && (fe.element.style.display = 'none'),
      e.add(fe);
  }
  getSelfDesignDiv(e, t) {
    var n = this,
      i = this.config,
      r = (i.barConfig, i.textConfig),
      a = i.titleScale,
      o = i.baseConfig,
      s = a.max - (t * (a.max - a.min)) / this.lightBars.length,
      l = r.area,
      u = l.areaWidth,
      c = l.areaHeight,
      h = l.areaBgColor,
      p = l.areaOffsetLeft,
      d = l.areaOffsetTop,
      f = r.suffix,
      m = f.suffixContent,
      g = f.suffixTranslate,
      v = f.suffixFont,
      _ = r.order,
      b = _.orderOffsetHorizontal,
      x = _.orderOffsetVertical,
      w = _.isLeftOffset,
      M = _.isTopOffset,
      S = _.orderBoxSize,
      T = _.orderTextFontFamily,
      A = _.orderTextFontSize,
      E = _.orderTextColor,
      L = _.orderOuterCenterColor,
      C = _.orderOuterOuterColor,
      P = _.orderInnerCenterColor,
      N = _.orderInnerOuterColor,
      O = w ? b + p + 'px' : 'auto',
      F = w ? 'auto' : b + p + 'px',
      R = M ? x + d + 'px' : 'auto',
      I = M ? 'auto' : x + d + 'px',
      D = r.count,
      G = D.isLeftOffset,
      U = D.isTopOffset,
      B = D.countOffsetHorizontal,
      j = D.countOffsetVertical,
      z = D.countBorderWidth,
      k = D.countBorderRadius,
      H = D.countWrapWidth,
      V = D.countWrapHeight,
      W = D.countFontFamily,
      X = D.countFontSize,
      Y = D.countTextColor,
      q = D.countBorderColor,
      Q = D.countBackgroundColor,
      Z = D.countDotCount,
      J = G ? B + p + 'px' : 'auto',
      $ = G ? 'auto' : B + p + 'px',
      K = U ? j + d + 'px' : 'auto',
      ee = U ? 'auto' : j + d + 'px',
      te = r.address,
      ne = te.addFontFamily,
      ie = te.addOffsetHorizontal,
      re = te.addOffsetVertical,
      ae = te.isLeftOffset,
      oe = te.isTopOffset,
      se = te.addWrapWidth,
      le = te.addFontSize,
      ue = te.addColor,
      ce = ae ? ie + 'px' : 'auto',
      he = ae ? 'auto' : ie + 'px',
      pe = oe ? re + 'px' : 'auto',
      de = oe ? 'auto' : re + 'px',
      fe = document.createElement('div'),
      me = document.createElement('div');
    fe.appendChild(me),
      this.planes.push(fe),
      (me.style.background = h),
      (me.style.transformOrigin = 'center bottom'),
      (me.style.height = c + 'px'),
      (me.style.width = u + 'px'),
      (me.style.transform = 'translate(-50%,-100%) scale('.concat(s, ') ')),
      (me.style.position = 'absolute');
    var ge = document.createElement('div'),
      ve = document.createElement('div'),
      ye = document.createElement('div');
    (ge.innerHTML = '\n      <div style="\n      position: absolute;\n      left:'
      .concat(O, ';\n      right:')
      .concat(F, ';\n      top:')
      .concat(R, ';\n      bottom:')
      .concat(I, ';\n\n      border-radius: 50%;\n      background-image: radial-gradient(circle,')
      .concat(L, ' 62%,')
      .concat(L, ' 62%, ')
      .concat(C, ',')
      .concat(C, ');\n      width: ')
      .concat(S, 'px;\n      height: ')
      .concat(
        S,
        'px;\n      display: flex;\n      justify-content: center;\n      align-items: center;\n      ">\n        <div style="\n            background-image: radial-gradient(circle,'
      )
      .concat(P, ', ')
      .concat(N, ');\n            border-radius: 50%;\n            width: ')
      .concat(S, 'px;\n            height: ')
      .concat(
        S,
        'px;\n            justify-content: center;\n            align-items: center;\n            font-family: '
      )
      .concat(T, ';\n            font-size: ')
      .concat(A, 'px;\n            display: flex;\n            color: ')
      .concat(E, ';\n        ">\n            ')
      .concat(t, '\n        </div>\n      </div>\n    ')),
      (ve.innerHTML = '\n      <div style="\n        position: absolute;\n        left:'
        .concat(J, ';\n        right:')
        .concat($, ';\n        top:')
        .concat(K, ';\n        bottom:')
        .concat(
          ee,
          ';\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        border:'
        )
        .concat(z, 'px solid ')
        .concat(q, ';\n        border-radius: ')
        .concat(k, 'px;\n        font-family: ')
        .concat(W, ';\n        font-size: ')
        .concat(X, 'px;\n        color: ')
        .concat(Y, ';\n        width: ')
        .concat(H, 'px;\n        height: ')
        .concat(V, 'px;\n        text-align: center;\n        padding: 5px;\n        background: ')
        .concat(Q, ';\n      ">\n        <span>')
        .concat(
          Number(e.userData.count).toFixed(Z),
          '</span>\n        <span style="\n        font-family: '
        )
        .concat(v.suffixFontFamily, ';\n        font-size: ')
        .concat(v.suffixFontSize, 'px;\n        margin-left: ')
        .concat(g.x, 'px;\n        color: ')
        .concat(v.suffixColor, ';\n        ">')
        .concat(m, '</span>\n      </div>\n    ')),
      (ye.innerHTML = '\n    <div style="\n      text-align: center;\n      width: '
        .concat(se, 'px;\n\n      position: absolute;\n      left:')
        .concat(ce, ';\n      right:')
        .concat(he, ';\n      top:')
        .concat(pe, ';\n      bottom:')
        .concat(de, ';\n\n      font-family:')
        .concat(ne, ';font-size:')
        .concat(le, 'px;color:')
        .concat(ue, '"\n    >')
        .concat(e.userData.add, '\n    </div>\n    ')),
      me.appendChild(ge),
      me.appendChild(ve),
      me.appendChild(ye),
      ge.addEventListener('click', function (t) {
        n.onSelect(e.userData), t.stopPropagation();
      }),
      ve.addEventListener('click', function (t) {
        n.onSelect(e.userData), t.stopPropagation();
      }),
      ye.addEventListener('click', function (t) {
        n.onSelect(e.userData), t.stopPropagation();
      });
    var _e = new y.CSS2DObject(fe);
    (this.laberDiv = fe),
      (fe.style.pointerEvents = o.mouseEvent ? 'auto' : 'none'),
      (_e.position.y = e.userData.height / 2),
      (e.userData.plane = _e),
      'slider' == o.actionWay && (_e.element.style.display = 'none'),
      e.add(_e);
  }
  updateMaterials(e, t) {
    var n, i, r, a, o;
    (n = (o =
      'none' == t
        ? this.getMatColor(this.config.barConfig.color)
        : this.getMatColor(this.config.baseConfig.sliderPassStyle.color)).bottomColor),
      (i = o.bottomOpacity),
      (r = o.topColor),
      (a = o.topOpacity);
    for (var s = 0; s < e.material.length; s++) {
      var l = e.material[s];
      'ShaderMaterial' == l.type
        ? ((l.uniforms.bottomColor.value = n),
          (l.uniforms.bottomOpacity.value = i),
          (l.uniforms.topColor.value = r),
          (l.uniforms.topOpacity.value = a))
        : (l.color = r);
    }
  }
  handleMouseMove(e) {
    if ('auto' != this.config.baseConfig.actionWay) {
      var t,
        n,
        i,
        r,
        a,
        o,
        s,
        l,
        u,
        c = (function (e, t, n) {
          var i = new y.Raycaster();
          return i.setFromCamera(e, t), i.intersectObjects(n, !0);
        })(
          ((t = e.clientX),
          (n = e.clientY),
          (i = this.container),
          (r = i.getBoundingClientRect()),
          (a = r.left),
          (o = r.top),
          (s = r.width),
          (l = r.height),
          ((u = new y.Vector2()).x = ((t - a) / s) * 2 - 1),
          (u.y = (-(n - o) / l) * 2 + 1),
          u),
          this.camera,
          this.lightBars
        );
      if (c.length > 0) {
        var h = c[0].object,
          p = h.userData.plane;
        p &&
          (this.selectedBar &&
            ((this.selectedBar.userData.plane.element.style.display = 'none'),
            this.updateMaterials(this.selectedBar, 'none')),
          (p.element.style.display = 'block'),
          this.updateMaterials(h, 'block'),
          (this.selectedBar = h));
      } else
        this.selectedBar &&
          ((this.selectedBar.userData.plane.element.style.display = 'none'),
          this.updateMaterials(this.selectedBar, 'none'),
          (this.selectedBar = null));
    }
  }
  updateComponent(e) {
    var t = this.config,
      n = t.barConfig,
      i = t.textConfig,
      r = t.baseConfig,
      a = t.baseHeight,
      o = t.isBgImg,
      s = t.titleScale,
      l = this.data;
    (this.data = e.data), (this.config = e.configuration.lightBar);
    var u = this.config,
      c = u.barConfig,
      h = u.textConfig,
      p = u.baseConfig,
      d = u.baseHeight,
      f = u.isBgImg,
      m = u.titleScale;
    if (
      (Object(x.isEqual)(l, this.data) ||
        (this.distoryPlanes(),
        this.disposeBar(),
        (this.barGroup.visible = !0),
        (this.container.children[0].style.visibility = ''),
        this.showData()),
      !Object(x.isEqual)(n.color, c.color))
    ) {
      var g = this.initMaterial();
      this.lightBars.map(function (e) {
        return (e.material = g);
      });
    }
    (Object(x.isEqual)(n.barType, c.barType) &&
      Object(x.isEqual)(n.maxHeight, c.maxHeight) &&
      Object(x.isEqual)(n.raiseTime, c.raiseTime) &&
      Object(x.isEqual)(n.scaleR, c.scaleR) &&
      Object(x.isEqual)(n.scaleY, c.scaleY) &&
      Object(x.isEqual)(n.size, c.size) &&
      Object(x.isEqual)(a, d) &&
      Object(x.isEqual)(r.showLevel, p.showLevel) &&
      Object(x.isEqual)(r.actionWay, p.actionWay) &&
      Object(x.isEqual)(i, h) &&
      Object(x.isEqual)(o, f) &&
      Object(x.isEqual)(s, m)) ||
      (this.distoryPlanes(), this.disposeBar(), this.showData()),
      this.refreshVisible();
  }
  updateBarHeight(e, t) {
    t += this.config.heightConfig.selectedHeight;
    var n = this.lightBars.filter(function (t) {
      return t.userData.adcode == e;
    })[0];
    null != n &&
      (null !== this.lastBar &&
        0 !== this.lastBar.position.y &&
        (this.lastBar.position.y = this.lastBar.userData.baseHeight),
      (n.position.y = n.userData.baseHeight + t),
      (this.lastBar = n));
  }
  getInToSub() {
    var e = this.config.baseConfig.showLevel,
      t = this.config.heightConfig.subBaseHeight;
    (this.barGroup.position.y = t),
      (this.currentLevel = 1),
      this.disposeBar(),
      this.distoryPlanes(),
      (-1 != e && 1 != e) || this.showData();
  }
  backToMain() {
    var e = this.config.baseConfig.showLevel,
      t = this.config.heightConfig.baseHeight;
    (this.barGroup.position.y = t),
      (this.currentLevel = 0),
      this.disposeBar(),
      this.distoryPlanes(),
      (-1 != e && 0 != e) || this.showData();
  }
  onSelect(e) {
    var t = this.parentProps.emit;
    t && t('click', [e], this.id), this.onRelativeAction(e);
  }
  onRelativeAction(e) {
    var t = this.interaction.callback,
      n = {};
    for (var i in t) {
      var r = t[i],
        a = r.target,
        o = r.origin;
      void 0 !== e[o] && (n[a] = e[o]);
    }
    this.parentProps.onRelative(this.parentProps.id, n);
  }
  distoryPlanes() {
    this.container &&
      this.container.children &&
      this.container.children[0] &&
      (this.container.children[0].innerHTML = '');
  }
  disposeBar() {
    for (; this.barGroup.children.length > 0; ) {
      var e = this.barGroup.children[0];
      void 0 !== e.geometry && e.geometry.dispose(),
        e.material.map(function (e) {
          e.dispose();
        }),
        this.barGroup.remove(e);
    }
    this.lightBars = [];
  }

  destroy() {
    null !== this.appearTween &&
      (cancelAnimationFrame(this.appearTween), (this.appearTween = null)),
      (this.raycaster = null),
      (this.data = null),
      (this.planes = null),
      (this.lightBars = null),
      (this.config = null),
      (this.selectedBar = null),
      (this.lastBar = null),
      this.container && this.container.removeEventListener('mousemove', this.handleMouseMove),
      this.distoryPlanes(),
      this.disposeBar(),
      (this.container = null);
  }
}
class extrudeArea {
  constructor(e, i) {
    var r;
    return (
      Object(c.a)(this, n),
      ((r = t.call(this, e)).config = e.configuration.extrudeArea),
      (r.interaction = e.configuration.interaction),
      (r.data = e.data),
      (r.srcLnglatToWorld = i.srcLnglatToWorld),
      (r.childrenGroup = i.childrenGroup),
      (r.onRelative = i.onRelative),
      (r.width = i.width),
      (r.height = i.height),
      (r.showGroup = new y.Group()),
      (r.showGroup.visible = r.config.baseConfig.showLevel <= 0),
      (r.showGroup.position.y = r.config.baseConfig.height),
      r.childrenGroup.add(r.showGroup),
      r.initMaterial(),
      r.showData(r.getUrl(r.data, r.config.baseConfig)),
      r
    );
  }
  getUrl(e, t) {
    var n = Object(jn.a)(e, 1)[0],
      i = t.url;
    return n && n.url ? n.url : i ? window.appConfig.ASSETS_URL + i : '';
  }
  initMaterial() {
    var e = this.config.mapStyleConfig;
    (this.materialPool = {
      mapTopSurfaceMaterial: new y.MeshBasicMaterial({
        transparent: !0
      }),
      mapSideSurfaceMaterial: new y.MeshPhongMaterial({
        transparent: !0
      }),
      mapTopLineMaterial: new y.LineMaterial({
        transparent: !0,
        linewidth: e.topLineWidth
      }),
      mapBottomLineMaterial: new y.LineMaterial({
        transparent: !0,
        linewidth: e.bottomLineWidth
      }),
      subMapBottomEffectMaterial: void 0
    }),
      zn(this.materialPool.mapTopSurfaceMaterial, e.topSurfaceColor),
      zn(this.materialPool.mapSideSurfaceMaterial, e.sideSurfaceColor),
      zn(this.materialPool.mapTopLineMaterial, e.topLineColor),
      zn(this.materialPool.mapBottomLineMaterial, e.bottomLineColor),
      this.materialPool.mapTopLineMaterial.resolution.set(this.width, this.height),
      this.materialPool.mapBottomLineMaterial.resolution.set(this.width, this.height);
  }
  showData(e) {
    var t = this;
    e &&
      fetch(e)
        .then(function (e) {
          return e.json();
        })
        .then(function (e) {
          t.drawMap(e);
        });
  }
  drawMap(e) {
    var t = this,
      n = this.config,
      i = n.mapStyleConfig;
    n.baseConfig;
    e.features.forEach(function (e) {
      if (e.geometry) {
        var n = e.geometry.coordinates;
        switch (e.geometry.type) {
          case 'Polygon':
            kn({
              coordinates: n,
              srcLnglatToWorld: t.srcLnglatToWorld,
              materialPool: t.materialPool,
              showGroup: t.showGroup,
              geographicalFence: t.geographicalFence,
              mapStyleConfig: i,
              feature: e
            });
            break;
          case 'MultiPolygon':
            n.forEach(function (n) {
              kn({
                coordinates: n,
                srcLnglatToWorld: t.srcLnglatToWorld,
                materialPool: t.materialPool,
                showGroup: t.showGroup,
                geographicalFence: t.geographicalFence,
                mapStyleConfig: i,
                feature: e
              });
            });
        }
      }
    });
  }
  updateComponent(e, t) {
    var n = this.config,
      i = n.baseConfig,
      r = (n.mapStyleConfig, this.data),
      a = this.getUrl(r, i);
    (this.config = e.configuration.extrudeArea), (this.data = e.data);
    var o = this.config,
      s = o.baseConfig,
      l = o.mapStyleConfig,
      u = this.getUrl(this.data, s);
    (a === u && i.height === s.height && i.flotageHeight === s.flotageHeight) ||
      (Object(On.deepDisposeGroupGeometry)(this.showGroup),
      (this.showGroup.children = []),
      this.showData(u)),
      (this.showGroup.position.y = s.height),
      i.showLevel !== s.showLevel && this.updateMapLevel(t.mapLevel),
      zn(this.materialPool.mapTopSurfaceMaterial, l.topSurfaceColor),
      zn(this.materialPool.mapSideSurfaceMaterial, l.sideSurfaceColor),
      zn(this.materialPool.mapTopLineMaterial, l.topLineColor),
      (this.materialPool.mapTopLineMaterial.linewidth = l.topLineWidth),
      zn(this.materialPool.mapBottomLineMaterial, l.bottomLineColor),
      (this.materialPool.mapBottomLineMaterial.linewidth = l.bottomLineWidth),
      this.geographicalFence &&
        (this.geographicalFence.material.uniforms.color.value = new y.Color().setStyle(
          l.fenceColor.toLocaleLowerCase()
        ));
  }
  updateMapLevel(e, t, n) {
    var i = this.config.baseConfig;
    i.showLevel < 0 || e === i.showLevel
      ? ((this.showGroup.visible = !0),
        Object(On.deepDisposeGroupGeometry)(this.showGroup),
        (this.showGroup.children = []),
        this.showData(this.getUrl(this.data, i)))
      : (this.showGroup.visible = !1);
  }
  destroy() {
    this.childrenGroup.remove(this.showGroup),
      Object(On.deepDisposeGroupGeometry)(this.showGroup),
      this.materialPool.mapBottomLineMaterial.dispose(),
      this.materialPool.mapTopLineMaterial.dispose(),
      this.materialPool.mapTopSurfaceMaterial.dispose(),
      this.materialPool.mapSideSurfaceMaterial.dispose(),
      (this.materialPool = null),
      (this.geographicalFence = null),
      (this.data = null);
  }
}
class textPlane {
  constructor(e, i) {
    var r;
    return (
      Object(c.a)(this, n),
      ((r = t.call(this, e)).childrenGroup = i.childrenGroup),
      (r.config = e.configuration.textPlane),
      (r.interaction = e.configuration.interaction),
      (r.srcLnglatToWorld = i.srcLnglatToWorld),
      (r.data = e.data),
      (r.showGroup = new y.Group()),
      r.childrenGroup.add(r.showGroup),
      (r.showGroup.visible = r.config.baseConfig.showLevel <= 0),
      r.showData(),
      r
    );
  }
  showData() {
    var e = this,
      t = this.config.baseConfig;
    this.showGroup && (Object(On.deepDisposeGroup)(this.showGroup), (this.showGroup.children = [])),
      this.data.forEach(function (n) {
        var i = e.createNameTexture(n.name),
          r = e.srcLnglatToWorld([n.lng, n.lat]),
          a = new y.PlaneGeometry((t.size * i.width) / i.height, t.size),
          o = new y.Mesh(
            a,
            new y.MeshBasicMaterial({
              color: 16777215,
              transparent: !0,
              map: i.nameTexture,
              depthTest: !1
            })
          );
        (o.renderOrder = 101), o.rotateX(-Math.PI / 2);
        var s = new y.Group();
        s.add(o),
          (s.position.x = r.x),
          (s.position.y = t.height),
          (s.position.z = -r.y),
          e.showGroup.add(s);
      });
  }
  createNameTexture(e) {
    var t = this.config.baseConfig,
      n = document.createElement('canvas');
    (n.style.position = 'absolute'), n.setAttribute('height', 64);
    var i = n.getContext('2d');
    i.font = 'normal '.concat(52, 'px ', t.fontFamily);
    var r = i.measureText(e).width;
    n.setAttribute('width', r),
      (i.font = 'normal '.concat(52, 'px ', t.fontFamily)),
      (i.fillStyle = t.color),
      (i.textAlign = 'center'),
      (i.textBaseline = 'middle'),
      i.fillText(e, r / 2, Math.ceil(32));
    var a = new y.Texture(n);
    return (
      (a.magFilter = y.LinearFilter),
      (a.minFilter = y.LinearFilter),
      (a.needsUpdate = !0),
      {
        nameTexture: a,
        width: r,
        height: 64
      }
    );
  }
  updateComponent(e, t) {
    var n = this.config,
      i = this.data;
    (this.config = e.configuration.textPlane),
      (this.data = e.data),
      (Object(x.isEqual)(i, this.data) && Object(x.isEqual)(n, this.config)) ||
        (this.showData(),
        (this.showGroup.visible =
          this.config.baseConfig.showLevel < 0 || this.config.baseConfig.showLevel === t.mapLevel));
  }
  updateMapLevel(e, t, n) {
    (this.showGroup.visible =
      this.config.baseConfig.showLevel < 0 || e === this.config.baseConfig.showLevel),
      n && this.showData(this.showData);
  }
  destroy() {
    this.childrenGroup.remove(this.showGroup),
      Object(On.deepDisposeGroup)(this.showGroup),
      (this.config = null),
      (this.data = null);
  }
}
class areaHeat {
  constructor(e, i) {
    this.type = 'areaHeat';
    this.props = e;
    r.mapGroup = i.mapGroup;
    r.list = i.context.isSub ? i.subMainMapGroup.children : i.mapGroup.children;
    if (i.materialPool) {
      r.mainMapTopSurfaceMaterial = i.materialPool.mainMapTopSurfaceMaterial;
      r.subMapTopSurfaceMaterial = i.materialPool.subMapTopSurfaceMaterial;
    }
    this.config = e.configuration.areaHeat;
    r.heatMaterials = {};
    r.data = e.data;
    r.group = new y.Group();
    i.mapGroup.parent.add(r.group);
    if (r.data && r.data.length > 0) {
      var d = r.colorData(r.flatten(r.data), this.config.areaHeatConfig);
      r.initMaterials(d, this.config.areaHeatConfig);
      r.coverMaterials();
    }
    return r;
  }
  flatten(e) {
    var t = [
      e.map(function (e) {
        e.sub;
        return o(
          o({}, Wn(e, Xn)),
          {},
          {
            level0: !0
          }
        );
      })
    ];
    return e.reduce(function (e, t) {
      var n = t.sub;
      return n ? [].concat(u(e), [n]) : e;
    }, t);
  }
  colorData(e, t) {
    t.minColor;
    t.maxColor;
    var n = t.gradient;
    i = [];
    return (
      Object.keys(n).map(function (e) {
        var t = n[e];
        i.push({
          r: t.proportion,
          color: t.color
        });
      }),
      i.sort(function (e, t) {
        return e.r - t.r;
      }),
      i[0] &&
        (i = [
          {
            r: 0,
            color: i[0].color
          }
        ].concat(u(i))),
      i.length > 0 &&
        i.push({
          r: 1,
          color: i[i.length - 1].color
        }),
      e.reduce(function (e, t) {
        for (
          var n = Object(ce.extent)(t, function (e) {
              return e.value;
            }),
            r = Object(jn.a)(n, 2),
            a = r[0],
            s = r[1] - a,
            l = Object(ce.scaleLinear)()
              .domain(
                i.map(function (e) {
                  return a + e.r * s;
                })
              )
              .range(
                i.map(function (e) {
                  return e.color;
                })
              ),
            c = 0,
            h = t.length;
          c < h;
          c++
        ) {
          var p = t[c];
          e = [].concat(u(e), [
            o(
              o({}, p),
              {},
              {
                coverColor: l(p.value)
              }
            )
          ]);
        }
        return e;
      }, [])
    );
  }
  initMaterials(e, t) {
    var n = t.backupColor;
    this.backupMateiral = new y.MeshPhongMaterial({
      color: new y.Color().setStyle(n.toLocaleLowerCase()),
      transparent: !0,
      opacity: Object(ce.rgb)(n.toLocaleLowerCase()).opacity,
      depthWrite: !1
    });
    for (var i = 0, r = e.length; i < r; i++) {
      var a = e[i],
        o = a.adcode,
        s = a.coverColor,
        l = a.level0;
      (this.heatMaterials[o] = new y.MeshPhongMaterial({
        color: new y.Color().setStyle(s.toLocaleLowerCase()),
        transparent: !0,
        opacity: Object(ce.rgb)(s.toLocaleLowerCase()).opacity,
        depthWrite: !1
      })),
        (this.heatMaterials[o].userData = {
          level0: l
        });
    }
  }
  coverMaterials() {
    var e = this.list,
      t = this.heatMaterials,
      n = Object.keys(this.heatMaterials).length > 0;
    if (e && n && e.length > 0)
      for (var i = 0, r = e.length; i < r; i++) {
        var a = e[i].userData;
        if (a) {
          var o = a.adcode,
            s = a.type;
          if (t[o] && 'surface' === s) {
            var l = e[i].clone();
            (l.material = [t[o], null]), this.group.add(l);
          } else if (!t[o] && 'surface' === s) {
            var u = e[i].clone();
            (u.material = this.backupMateiral), this.group.add(u);
          }
        }
      }
  }
  setCurrentGroup(e) {
    this.currentGroup = e;
  }
  updateComponent(e, t) {
    var n = this.props.configuration.areaHeat.areaHeatConfig,
      i = e.data,
      r = e.configuration,
      a = (this.config = r.areaHeat).areaHeatConfig;
    if (i && i.length > 0) {
      if (!Object(x.isEqual)(i, this.data) || !Object(x.isEqual)(a, n)) {
        this.disposeGroup(this.group), (this.heatMaterials = {}), (this.data = i);
        var o = this.colorData(this.flatten(this.data), a);
        this.initMaterials(o, a);
      }
    } else (this.data = i), this.disposeGroup(this.group), (this.heatMaterials = {});
    this.coverMaterials(t.mapGroup);
  }
  filterHeatMaterials() {
    for (var e in this.heatMaterials) this.heatMaterials[e] || delete this.heatMaterials[e];
  }
  recovermaterial(e) {
    var t = this.heatMaterials[e];
    this.heatMaterials[e] = t.userData.level0
      ? this.mainMapTopSurfaceMaterial
      : this.subMapTopSurfaceMaterial;
  }
  disposeMaterial(e) {
    Object(On.disposeMaterial)(this.heatMaterials[e]);
  }
  disposeGroup(e) {
    for (; e.children.length > 0; ) {
      var t = e.children[0];
      t.geometry && t.geometry.dispose();
      e.remove(t);
    }
  }
  destroy() {
    this.mapGroup.parent.remove(this.group);
    Object(On.deepDisposeGroup)(this.group);
  }
}
class typeBubble {
  function(e) {
    Object(d.a)(n, e);
    var t = Object(f.a)(n);
    function n(e, i) {
      var r;
      Object(c.a)(this, n),
        ((r = t.call(this, e)).childrenGroup = i.childrenGroup),
        (r.config = e.configuration.typeBubble),
        (r.srcLnglatToWorld = i.srcLnglatToWorld),
        (r.data = e.data),
        (r.interactionData = {
          rootProps: i.parentProps,
          configInteraction: e.configuration,
          childId: e.id
        }),
        (r.showGroup = new y.Group()),
        r.childrenGroup.add(r.showGroup),
        (r.bubbleArray = []),
        r.showData(r.data),
        (r.currentIndex = 0);
      var a = r.config.baseConfig;
      return (
        a.carouselConfig.show && a.showLevel <= 0
          ? (r.hiddenAll(), r.showCurrent(r.currentIndex), r.startCarousel())
          : !a.carouselConfig.show && a.showLevel <= 0 && r.showAll(),
        r
      );
    }
    return (
      Object(h.a)(n, [
        {
          key: 'stopCarousel',
          value: function () {
            this.interval && clearInterval(this.interval);
          }
        },
        {
          key: 'startCarousel',
          value: function () {
            var e = this,
              t = this.config.baseConfig;
            this.stopCarousel(),
              t.carouselConfig.time
                ? (this.interval = setInterval(function () {
                    var t = e.showGroup.children[e.currentIndex];
                    t && (t.element.style.display = 'none'),
                      (e.currentIndex = e.currentIndex + 1),
                      e.currentIndex >= e.showGroup.children.length && (e.currentIndex = 0),
                      e.showGroup.children[e.currentIndex] && e.showCurrent(e.currentIndex);
                  }, 1e3 * t.carouselConfig.time))
                : this.showGroup.traverse(function (e) {
                    e.element.style.display = '';
                  });
          }
        },
        {
          key: 'showCurrent',
          value: function (e) {
            var t = this.showGroup.children[e];
            t && (t.element.style.display = '');
          }
        },
        {
          key: 'showData',
          value: function (e) {
            this.removeAll();
            var t = this.config,
              n = t.baseConfig,
              i = t.bubbleConfig,
              r = t.typeConfig,
              a = t.valueConfig,
              o = {};
            Object.keys(r).map(function (e) {
              o[r[e].typeValue] = r[e].imageUrl;
            });
            var s = {};
            Object.keys(a).map(function (e) {
              s[a[e].valueName] = a[e];
            });
            var l,
              u = Object(m.a)(e);
            try {
              for (u.s(); !(l = u.n()).done; ) {
                var c = l.value;
                if (o[c.type]) {
                  var h = document.createElement('div');
                  (h.key = Math.random()),
                    (h.style.position = 'relative'),
                    Object(qn.render)(
                      v.a.createElement(Zn, {
                        bubbleConfig: i,
                        backgroundImage: o[c.type],
                        data: c,
                        valueConfigObject: s,
                        interactionData: this.interactionData
                      }),
                      h
                    );
                  var p = this.srcLnglatToWorld([c.lng, c.lat]),
                    d = new y.CSS2DObject(h);
                  (d.position.x = p.x),
                    (d.position.y = i.positionHeight),
                    (d.position.z = -p.y),
                    (d.element.style.display =
                      n.carouselConfig.show || n.showLevel > 0 ? 'none' : ''),
                    this.bubbleArray.push(d),
                    this.showGroup.add(d);
                }
              }
            } catch (e) {
              u.e(e);
            } finally {
              u.f();
            }
          }
        },
        {
          key: 'hiddenAll',
          value: function () {
            this.showGroup.traverse(function (e) {
              e.element && (e.element.style.display = 'none');
            });
          }
        },
        {
          key: 'showAll',
          value: function () {
            this.showGroup.traverse(function (e) {
              e.element && (e.element.style.display = '');
            });
          }
        },
        {
          key: 'updateMapLevel',
          value: function (e, t, n) {
            t && (this.srcLnglatToWorld = t.srcLnglatToWorld);
            var i = this.config.baseConfig;
            this.stopCarousel(),
              i.showLevel >= 0
                ? e === i.showLevel
                  ? n
                    ? (this.showData(this.data),
                      i.carouselConfig.show
                        ? (this.showCurrent(this.currentIndex), this.startCarousel())
                        : this.showAll())
                    : i.carouselConfig.show
                    ? (this.hiddenAll(), this.showCurrent(this.currentIndex), this.startCarousel())
                    : this.showAll()
                  : this.hiddenAll()
                : (this.showData(this.data),
                  i.carouselConfig.show
                    ? (this.showCurrent(this.currentIndex), this.startCarousel())
                    : this.showAll());
          }
        },
        {
          key: 'updateComponent',
          value: function (e, t) {
            var n = this.config,
              i = n.baseConfig,
              r = n.bubbleConfig,
              a = n.valueConfig,
              o = n.typeConfig,
              s = this.data;
            (this.config = e.configuration.typeBubble), (this.data = e.data);
            var l = this.config,
              u = l.baseConfig,
              c = l.bubbleConfig,
              h = l.valueConfig,
              p = l.typeConfig;
            i.showLevel !== u.showLevel && this.updateMapLevel(t.mapLevel),
              Object(x.isEqual)(i.carouselConfig, u.carouselConfig) ||
                (this.stopCarousel(),
                u.carouselConfig.show
                  ? (this.showCurrent(this.currentIndex), this.startCarousel())
                  : this.showAll()),
              (Object(x.isEqual)(r, c) &&
                Object(x.isEqual)(a, h) &&
                Object(x.isEqual)(o, p) &&
                Object(x.isEqual)(s, this.data)) ||
                (this.currentIndex >= this.data.length && (this.currentIndex = 0),
                this.showData(this.data),
                0 === this.data.length && this.stopCarousel()),
              0 === this.data.length && this.stopCarousel();
          }
        },
        {
          key: 'removeAll',
          value: function () {
            var e,
              t = Object(m.a)(this.bubbleArray);
            try {
              for (t.s(); !(e = t.n()).done; ) {
                var n = e.value;
                this.showGroup.remove(n);
              }
            } catch (e) {
              t.e(e);
            } finally {
              t.f();
            }
            (this.showGroup.children = []), (this.bubbleArray = []);
          }
        },
        {
          key: 'destroy',
          value: function () {
            this.stopCarousel(), this.removeAll(), this.childrenGroup.remove(this.showGroup);
          }
        }
      ]),
      n
    );
  }
}
class image {
  function(e) {
    Object(d.a)(n, e);
    var t = Object(f.a)(n);
    function n(e, i) {
      var r;
      Object(c.a)(this, n),
        ((r = t.call(this, e)).tweenList = []),
        (r.objectTweenData = {}),
        (r.textureMgr = i.context.textureMgr),
        (r.props = e),
        (r.childrenGroup = i.childrenGroup),
        (r.config = e.configuration.image),
        (r.interaction = e.configuration.interaction),
        (r.srcLnglatToWorld = i.srcLnglatToWorld),
        (r.onRelative = i.onRelative),
        (r.camera = i.camera),
        (r.container = i.mapContainer),
        (r.currentIndex = 0),
        (r.parentProps = i.parentProps);
      var a = r.config.baseConfig;
      return (
        (r.group = new y.Group()),
        (r.group.visible = a.showLevel <= 0),
        (r.raycaster = new y.Raycaster()),
        r.childrenGroup.add(r.group),
        (r.handleClick = r.handleClick.bind(Object(p.a)(r))),
        r.container.addEventListener('click', r.handleClick, !1),
        r.initImage(),
        r
      );
    }
    return (
      Object(h.a)(n, [
        {
          key: 'handleClick',
          value: function (e) {
            var t, n, i, r, a, o, s, l, u;
            (function (e, t, n) {
              var i = new y.Raycaster();
              return i.setFromCamera(e, t), i.intersectObjects(n, !0);
            })(
              ((t = e.clientX),
              (n = e.clientY),
              (i = this.container),
              (r = i.getBoundingClientRect()),
              (a = r.left),
              (o = r.top),
              (s = r.width),
              (l = r.height),
              ((u = new y.Vector2()).x = ((t - a) / s) * 2 - 1),
              (u.y = (-(n - o) / l) * 2 + 1),
              u),
              this.camera,
              this.group.children
            ).length > 0 &&
              this.props.id &&
              this.parentProps.emit &&
              this.parentProps.emit('clickImage', [], this.props.id);
          }
        },
        {
          key: 'update',
          value: function (e) {
            var t = this;
            this.group.children &&
              this.group.children.map(function (e) {
                var n = e.userData,
                  i = n.show,
                  r = n.rotationAxis,
                  a = n.speed;
                if ((i && (e.rotation[r] += a), t.objectTweenData[e.uuid])) {
                  var o = t.objectTweenData[e.uuid];
                  e.scale.set(o.scaleX, o.scaleY, o.scaleZ),
                    (e.material.opacity = o.opacity),
                    (e.material.needsUpdate = !0);
                }
              });
          }
        },
        {
          key: 'updateComponent',
          value: function (e) {
            var t = this.config,
              n = t.baseConfig,
              i = t.animatePlane;
            this.config = e.configuration.image;
            var r = this.config,
              a = r.baseConfig,
              o = r.animatePlane;
            Object(x.isEqual)(a, n) || (this.group && (this.group.visible = a.showLevel <= 0)),
              Object(x.isEqual)(i, o) || (this.disposeImageGroup(this.group), this.initImage());
          }
        },
        {
          key: 'initKeyFrameAnimation',
          value: function (e, t) {
            var n = Object.values(t);
            if (!(n.length <= 1)) {
              var i = {
                scaleX: 1,
                scaleY: 1,
                scaleZ: 1,
                opacity: 1
              };
              this.objectTweenData[e.uuid] = i;
              var r = (function (e) {
                return new li(e);
              })(i);
              this.tweenList.push(r);
              var a = n[0];
              r.callback(function () {
                Object.assign(i, {
                  scaleX: a.scale.x,
                  scaleY: a.scale.y,
                  scaleZ: a.scale.z,
                  opacity: a.opacity
                });
              });
              for (var o = 1; o < n.length; o++) {
                var s = n[o];
                r.to(
                  {
                    scaleX: s.scale.x,
                    scaleY: s.scale.y,
                    scaleZ: s.scale.z,
                    opacity: s.opacity
                  },
                  s.time - n[o - 1].time
                );
              }
              r.loop();
            }
          }
        },
        {
          key: 'initImage',
          value: function () {
            var e = this,
              t = this.config.animatePlane;
            this.tweenList.forEach(function (e) {
              return e.destroy();
            }),
              (this.tweenList = []);
            var n = t.planes;
            Object.values(n).forEach(function (t) {
              var n = t.size,
                i = t.opacity,
                r = t.url,
                a = t.isDoubleSide,
                o = t.baseRotation,
                s = t.basePosition,
                l = t.animation,
                u = t.keyFrameAnimation,
                c = l.show,
                h = l.rotationAxis,
                p = l.speed,
                d = e.textureMgr.get(r),
                f = new y.PlaneBufferGeometry(n, n),
                m = new y.MeshBasicMaterial({
                  map: d,
                  opacity: i,
                  transparent: !0,
                  side: a ? y.DoubleSide : y.FrontSide,
                  depthWrite: !1
                }),
                g = new y.Mesh(f, m);
              g.position.copy(s);
              var v = {
                x: (o.x * Math.PI) / 180,
                y: (o.y * Math.PI) / 180,
                z: (o.z * Math.PI) / 180
              };
              g.rotation.set(v.x, v.y, v.z),
                (g.userData = {
                  show: c,
                  speed: (p * Math.PI) / 180 / 60,
                  rotationAxis: h
                }),
                e.group.add(g),
                e.initKeyFrameAnimation(g, u);
            });
          }
        },
        {
          key: 'onRelativeAction',
          value: function (e) {
            var t = this.interaction.callback,
              n = {};
            for (var i in t) {
              var r = t[i],
                a = r.target,
                o = r.origin;
              void 0 !== e[o] && (n[a] = e[o]);
            }
            this.onRelative(n);
          }
        },
        {
          key: 'disposeImageGroup',
          value: function (e) {
            for (; e.children.length > 0; ) {
              var t = e.children[0];
              t &&
                (t.geometry && t.geometry.dispose(),
                t.geometry && t.material.dispose(),
                e.remove(t));
            }
          }
        },
        {
          key: 'updateMapLevel',
          value: function (e) {
            var t = this.config.baseConfig.showLevel;
            this.group.visible = -1 == t || e == t;
          }
        },
        {
          key: 'destroy',
          value: function () {
            this.disposeImageGroup(this.group),
              this.group && this.group.parent && this.group.parent.remove(this.group),
              (this.group = null),
              (this.config = null),
              this.tweenList.forEach(function (e) {
                return e.destroy();
              }),
              (this.tweenList = []),
              this.container && this.container.removeEventListener('click', this.handleClick);
          }
        }
      ]),
      n
    );
  }
}
class stream {
  constructor(e, i) {
    var r;
    return (
      Object(c.a)(this, n),
      ((r = t.call(this, e)).props = e),
      (r.childrenGroup = i.childrenGroup),
      (r.config = e.configuration.stream),
      (r.group = new y.Group()),
      r.childrenGroup.add(r.group),
      e.data.length >= 2 && r.initStream(),
      r
    );
  }
  update() {
    if (this.line) {
      var e = this.config.animationConfig.speed;
      this.line.material.uniforms.time.value += e;
    }
  }
  updateComponent(e) {
    (this.config = e.configuration.stream),
      (this.props = e),
      e.data.length > 2 && (this.disposeStream(this.group), this.initStream());
  }
  initStream() {
    var e = this.config.basicConfig,
      t = e.lineWidth,
      n = e.lineType,
      i = this.initStreamPoints(),
      r = new y.CatmullRomCurve3(i),
      a = 100;
    'stright' == n && (a = Math.max(i.length - 1, 0));
    var o = new y.TubeGeometry(r, a, t, 8, !1),
      s = this.initStreamMaterial();
    (this.line = new y.Mesh(o, s)), this.group.add(this.line);
  }
  initStreamMaterial() {
    var e = this.config,
      t = e.basicConfig,
      n = e.animationConfig;
    return new y.ShaderMaterial({
      uniforms: {
        time: {
          type: 'f',
          value: 0
        },
        offset: {
          type: 'f',
          value: n.startRandom ? Math.random() * Math.random() * 10 : 0
        },
        lineShow: {
          value: !1
        },
        lineColor: {
          value: new y.Color().setStyle('#f00')
        },
        lineOpacity: {
          value: 1
        },
        startColor: {
          value: new y.Color().setStyle(t.startColor.toLocaleLowerCase())
        },
        startOpacity: {
          value: Object(ce.rgb)(t.startColor.toLocaleLowerCase()).opacity
        },
        endColor: {
          value: new y.Color().setStyle(t.endColor.toLocaleLowerCase())
        },
        endOpacity: {
          value: Object(ce.rgb)(t.endColor.toLocaleLowerCase()).opacity
        },
        lineLength: {
          value: t.lineLength
        }
      },
      vertexShader: fi.vertexShader,
      fragmentShader: fi.fragmentShader,
      transparent: !0
    });
  }
  initStreamPoints() {
    return this.props.data.map(function (e) {
      var t = e.x,
        n = e.y,
        i = e.z;
      return new y.Vector3(t, n, i);
    });
  }
  disposeStream(e) {
    for (; e.children.length > 0; ) {
      var t = e.children[0];
      t.geometry && t.geometry.dispose(), t.material && t.material.dispose(), e.remove(t);
    }
  }
  destroy() {
    this.disposeStream(this.group), this.childrenGroup.remove(this.group), (this.group = null);
  }
}
class sprites {
  constructor(e, i) {
    var r;
    return (
      Object(c.a)(this, n),
      ((r = t.call(this, e)).props = e),
      (r.childrenGroup = i.childrenGroup),
      (r.config = e.configuration.sprites),
      (r.group = new y.Group()),
      r.childrenGroup.add(r.group),
      r.switchMode(),
      r.initCloud(),
      r
    );
  }
  update() {
    this.cloud && this.cloudAnimate();
  }
  updateCloudTexture() {
    '' == this.config.basicConfig.url ? this.disposeCloud() : this.initCloud();
  }
  updateCloudCount() {
    if (this.cloud) {
      var e = this.config.basicConfig,
        t = e.count,
        n = e.size,
        i = this.config.animateConfig,
        r = i.horizontalSpeed,
        a = i.verticalSpeed,
        o = this.cloud.geometry.vertices,
        s = new y.Geometry();
      if (t < o.length) s.vertices = o.slice(0, t);
      else {
        var l = n.length,
          c = n.width,
          h = n.height;
        s.vertices = u(o);
        for (var p = 0; p < t - o.length; p++) {
          var d = new y.Vector3(
            Math.random() * l - l / 2,
            Math.random() * h - h / 2,
            Math.random() * c - c / 2
          );
          (d.vX = (Math.random() - 0.5) * r),
            (d.vZ = (Math.random() - 0.5) * r),
            (d.vY = (Math.random() + 0.01) * a),
            s.vertices.push(d);
        }
      }
      this.cloud.geometry.dispose(), (this.cloud.geometry = s);
    }
  }
  updateCloudBoxHelper() {
    var e = this.config.basicConfig.size,
      t = e.length,
      n = e.width,
      i = e.height,
      r = this.initCloudBox(t, i, n);
    this.cloud.userData.boxHelper.geometry.dispose(),
      this.cloud.remove(this.cloud.userData.boxHelper),
      (this.cloud.userData.boxHelper = r),
      this.cloud.add(r);
  }
  initCloudBox(e, t, n) {
    var i = new y.BoxBufferGeometry(e, n, t),
      r = new y.EdgesGeometry(i);
    return new y.LineSegments(
      r,
      new y.LineBasicMaterial({
        color: 16776960
      })
    );
  }
  initCloud() {
    var e = this,
      t = this.config.basicConfig,
      n = t.url,
      i = t.count,
      r = t.position,
      a = t.size,
      o = t.spriteSize,
      s = t.opacity,
      l = this.config.animateConfig,
      u = l.verticalSpeed,
      c = l.horizontalSpeed,
      h = r.x,
      p = r.y,
      d = r.z,
      f = a.length,
      m = a.width,
      g = a.height;
    new y.TextureLoader().load(window.appConfig.ASSETS_URL + n, function (t) {
      for (
        var n = new y.PointsMaterial({
            size: o,
            transparent: !0,
            opacity: s,
            map: t,
            blending: y.AdditiveBlending,
            depthTest: !1
          }),
          r = new y.Geometry(),
          a = 0;
        a < i;
        a++
      ) {
        var l = new y.Vector3(
          Math.random() * f - f / 2,
          Math.random() * g - g / 2,
          Math.random() * m - m / 2
        );
        (l.vX = (Math.random() - 0.5) * c),
          (l.vZ = (Math.random() - 0.5) * c),
          (l.vY = (Math.random() + 0.01) * u),
          r.vertices.push(l);
      }
      (e.cloud = new y.Points(r, n)), (e.cloud.sortParticles = !0);
      var v = e.initCloudBox(f, m, g);
      (v.visible = !1),
        (e.cloud.userData.boxHelper = v),
        e.cloud.position.set(h, p, d),
        e.cloud.add(v),
        e.group.add(e.cloud);
    });
  }
  cloudAnimate() {
    var e = this,
      t = this.config.basicConfig.size,
      n = t.length,
      i = t.width,
      r = t.height,
      a = this.config.animateConfig.win,
      o = a.show,
      s = a.dir,
      l = a.strength,
      u = this.cloud.geometry.vertices,
      c = o
        ? new y.Vector3(s.x, s.y, s.z).normalize().multiplyScalar(0.1 * l)
        : new y.Vector3(0, 0, 0);
    u.forEach(function (t) {
      t.add(c),
        (t.x -= t.vX),
        (t.z -= t.vZ),
        (t.y -= t.vY),
        (t.x <= -n / 2 || t.x >= n / 2) && ((t.x = (-n / 2) * Math.sign(t.vX)), (t.vX *= -1)),
        (t.z <= -i / 2 || t.z >= i / 2) && ((t.z = (-i / 2) * Math.sign(t.vZ)), (t.vZ *= -1)),
        (t.y <= -r / 2 || t.y >= r / 2) && (t.y = (r / 2) * Math.sign(t.vY)),
        (e.cloud.geometry.verticesNeedUpdate = !0);
    });
  }
  updateComponent(e) {
    var t = this.config;
    if (
      ((this.config = e.configuration.sprites),
      (this.props = e),
      !Object(x.isEqual)(t.animateConfig, this.config.animateConfig))
    ) {
      var n = this.config.animateConfig,
        i = n.horizontalSpeed,
        r = n.verticalSpeed;
      this.cloud &&
        this.cloud.geometry.vertices.map(function (e) {
          (e.vX = (Math.random() - 0.5) * i), (e.vY = Math.random() * r);
        });
    }
    if (
      (t.basicConfig.count !== this.config.basicConfig.count && this.updateCloudCount(),
      t.basicConfig.url !== this.config.basicConfig.url && this.updateCloudTexture(),
      t.basicConfig.spriteSize !== this.config.basicConfig.spriteSize &&
        this.cloud &&
        (this.cloud.material.size = this.config.basicConfig.spriteSize),
      t.basicConfig.opacity !== this.config.basicConfig.opacity &&
        this.cloud &&
        (this.cloud.material.opacity = this.config.basicConfig.opacity),
      !Object(x.isEqual)(t.basicConfig.position, this.config.basicConfig.position))
    ) {
      var a = this.config.basicConfig.position,
        o = a.x,
        s = a.y,
        l = a.z;
      this.cloud && this.cloud.position.set(o, s, l);
    }
    Object(x.isEqual)(t.basicConfig.size, this.config.basicConfig.size) ||
      this.updateCloudBoxHelper(),
      this.switchMode();
  }
  getIntoSpritesEdit() {
    this.cloud && (this.cloud.userData.boxHelper.visible = !0);
  }
  getOutSpritesEdit() {
    this.cloud && (this.cloud.userData.boxHelper.visible = !1);
  }
  switchMode() {
    this.props.edit ? this.getIntoSpritesEdit() : this.getOutSpritesEdit();
  }
  disposeCloud() {
    var e = this.cloud.userData.boxHelper;
    e && e.geometry && e.geometry.dispose(),
      e && e.material && e.material.dispose(),
      this.cloud.geometry.dispose(),
      this.cloud.material.dispose(),
      this.cloud.remove(e),
      this.group.remove(this.cloud),
      (this.cloud = null);
  }
  destroy() {
    this.disposeCloud();
  }
}
class raisingSprite {
  constructor(e, i) {
    var r;
    return (
      Object(c.a)(this, n),
      ((r = t.call(this, e)).props = e),
      (r.childrenGroup = i.childrenGroup),
      (r.config = e.configuration.raisingSprite),
      (r.camera = i.camera),
      (r.group = new y.Group()),
      r.childrenGroup.add(r.group),
      r.switchMode(),
      (r.FPS_COUNT = 10),
      r.initCloud(),
      r
    );
  }
  update() {
    this.cloud && this.cloudAnimate();
  }
  updateCloudBoxHelper() {
    var e = this.config.basicConfig.size,
      t = e.length,
      n = e.width,
      i = e.height,
      r = this.initCloudBox(t, i, n);
    (r.visible = Boolean(this.props.edit)),
      this.cloud.userData.boxHelper.geometry.dispose(),
      this.cloud.remove(this.cloud.userData.boxHelper),
      (this.cloud.userData.boxHelper = r),
      this.cloud.add(r);
  }
  initCloudBox(e, t, n) {
    var i = new y.BoxBufferGeometry(e, n, t),
      r = new y.EdgesGeometry(i);
    return new y.LineSegments(
      r,
      new y.LineBasicMaterial({
        color: 16776960
      })
    );
  }
  initCloudMaterial() {
    var e = this.config.basicConfig.codeTextures,
      t = e.url1,
      n = e.url2,
      i = e.url3,
      r = e.url4,
      a = e.url5,
      o = e.url6,
      s = e.url7,
      l = e.url8,
      u = e.url9,
      c = new y.TextureLoader();
    this.shader_material = new y.ShaderMaterial({
      uniforms: {
        texture1: {
          value: c.load(window.appConfig.ASSETS_URL + t)
        },
        texture2: {
          value: c.load(window.appConfig.ASSETS_URL + n)
        },
        texture3: {
          value: c.load(window.appConfig.ASSETS_URL + i)
        },
        texture4: {
          value: c.load(window.appConfig.ASSETS_URL + r)
        },
        texture5: {
          value: c.load(window.appConfig.ASSETS_URL + a)
        },
        texture6: {
          value: c.load(window.appConfig.ASSETS_URL + o)
        },
        texture7: {
          value: c.load(window.appConfig.ASSETS_URL + s)
        },
        texture8: {
          value: c.load(window.appConfig.ASSETS_URL + l)
        },
        texture9: {
          value: c.load(window.appConfig.ASSETS_URL + u)
        },
        random: {
          value: Math.random()
        }
      },
      vertexShader: Gn.f,
      fragmentShader: Gn.e,
      side: y.DoubleSide,
      depthWrite: !1,
      depthTest: !1,
      transparent: !0,
      blending: y.AdditiveBlending
    });
  }
  initCloud() {
    var e = this,
      t = this.config.basicConfig,
      n = (t.url, t.count),
      i = t.position,
      r = t.size,
      a = t.spriteWidth,
      o = t.spriteHeight,
      s = t.spriteWidthDown,
      l = t.spriteHeightDown,
      u = this.config.animateConfig,
      c = u.verticalSpeed,
      h = u.verticalSpeedDown,
      p = i.x,
      d = i.y,
      f = i.z,
      m = r.length,
      g = r.width,
      v = r.height;
    (this.cloud = new y.Group()), this.initCloudMaterial();
    for (
      var _ = function () {
          var t = new y.Vector3(
              Math.random() * m - m / 2,
              Math.random() * v - v / 2,
              Math.random() * g - g / 2
            ),
            n = h + (c - h) * Math.random(),
            i = new y.PlaneBufferGeometry(a + Math.random() * a - s, o + Math.random() * (o - l)),
            r = Math.floor(1e3 * Math.random()) + 1;
          i.attributes.uv.array = i.attributes.uv.array.map(function (e) {
            return e + r;
          });
          var u = new y.Mesh(i, e.shader_material);
          u.position.copy(t), (u.userData.vY = n), e.cloud.add(u);
        },
        b = 0;
      b < n;
      b++
    )
      _();
    var x = this.initCloudBox(m, g, v);
    (x.visible = Boolean(this.props.edit)),
      (this.cloud.userData.boxHelper = x),
      this.cloud.position.set(p, d, f),
      this.cloud.add(x),
      this.group.add(this.cloud);
  }
  cloudAnimate() {
    var e = this.config.basicConfig.size.height;
    this.FPS_COUNT++,
      this.FPS_COUNT >= this.config.basicConfig.flashCount &&
        (this.shader_material && (this.shader_material.uniforms.random.value = Math.random()),
        (this.FPS_COUNT = 0)),
      this.cloud.children.map(function (t) {
        if ('LineSegments' !== t.type) {
          var n = t.userData.vY;
          (t.position.y += n),
            (t.position.y >= e / 2 || t.position.y <= -e / 2) &&
              (t.position.y = (-e / 2) * Math.sign(n));
        }
      });
  }
  updateComponent(e) {
    var t = this.config;
    if (
      ((this.config = e.configuration.raisingSprite),
      (this.props = e),
      !Object(x.isEqual)(t.animateConfig, this.config.animateConfig))
    ) {
      var n = this.config.animateConfig,
        i = n.verticalSpeed,
        r = n.verticalSpeedDown;
      this.cloud &&
        this.cloud.children.map(function (e) {
          e.userData.vY = r + (i - r) * Math.random();
        });
    }
    if (
      ((t.basicConfig.count === this.config.basicConfig.count &&
        t.basicConfig.codeTextures === this.config.basicConfig.codeTextures &&
        t.basicConfig.spriteWidth === this.config.basicConfig.spriteWidth &&
        t.basicConfig.spriteHeight === this.config.basicConfig.spriteHeight &&
        t.basicConfig.spriteWidthDown === this.config.basicConfig.spriteWidthDown &&
        t.basicConfig.spriteHeightDown === this.config.basicConfig.spriteHeightDown) ||
        (this.disposeCloud(), this.initCloud()),
      !Object(x.isEqual)(t.basicConfig.position, this.config.basicConfig.position))
    ) {
      var a = this.config.basicConfig.position,
        o = a.x,
        s = a.y,
        l = a.z;
      this.cloud && this.cloud.position.set(o, s, l);
    }
    Object(x.isEqual)(t.basicConfig.size, this.config.basicConfig.size) ||
      this.updateCloudBoxHelper(),
      this.switchMode();
  }
  getIntoSpritesEdit() {
    this.cloud && this.cloud.userData.boxHelper && (this.cloud.userData.boxHelper.visible = !0);
  }
  getOutSpritesEdit() {
    this.cloud && this.cloud.userData.boxHelper && (this.cloud.userData.boxHelper.visible = !1);
  }
  switchMode() {
    this.props.edit ? this.getIntoSpritesEdit() : this.getOutSpritesEdit();
  }
  disposeCloud() {
    var e = this.cloud.userData.boxHelper;
    for (
      e && e.geometry && e.geometry.dispose(),
        e && e.material && e.material.dispose(),
        this.cloud.remove(e),
        this.cloud.userData.boxHelper = null;
      this.cloud.children.length > 0;

    ) {
      var t = this.cloud.children[0];
      t.geometry && t.geometry.dispose(), t.material && t.material.dispose(), this.cloud.remove(t);
    }
    this.group.remove(this.cloud), (this.cloud = null);
  }
  destroy() {
    this.disposeCloud();
  }
}
class joinHeat {
  constructor(e, i) {
    var r;
    Object(c.a)(this, n),
      ((r = t.call(this, e)).childrenGroup = i.childrenGroup),
      (r.config = e.configuration.joinHeat),
      (r.interaction = e.configuration.interaction),
      (r.dstLnglatToWorld = i.dstLnglatToWorld),
      (r.srcLnglatToWorld = i.srcLnglatToWorld),
      (r.onRelative = i.onRelative),
      (r.stretch = i.stretch);
    var a = i.mainConfig,
      o = a.maxLng,
      s = a.minLng,
      l = a.maxLat,
      u = a.minLat;
    return (
      (r.leftTopPos = r.dstLnglatToWorld([s, l])),
      (r.rightBottomPos = r.dstLnglatToWorld([o, u])),
      (r.heatWidth = r.rightBottomPos.x - r.leftTopPos.x),
      (r.heatHeight = r.leftTopPos.y - r.rightBottomPos.y),
      (r.group = new y.Group()),
      (r.group.name = 'joinHeat'),
      r.childrenGroup.add(r.group),
      (r.data = e.data),
      r.initHeatPlane(),
      r
    );
  }
  initHeatPlane() {
    var e = new y.PlaneBufferGeometry(this.heatWidth, this.heatHeight);
    (this.heatPlane = new y.Mesh(e, this.generateMaterial())),
      (this.heatPlane.rotation.x = -Math.PI / 2),
      (this.heatPlane.position.y = this.stretch),
      this.group.add(this.heatPlane);
  }
  disposeHeatPlane() {
    this.heatPlane &&
      (this.heatPlane.geometry && this.heatPlane.geometry.dispose(),
      this.heatPlane.material && this.heatPlane.material.dispose(),
      this.group.remove(this.heatPlane));
  }
  generateMaterial() {
    var e = this,
      t = this.config.heatConfig,
      n = t.radius,
      i = t.max,
      r = t.gradient,
      a = document.createElement('div');
    (a.style.width = this.heatWidth + 'px'),
      (a.style.height = this.heatHeight + 'px'),
      document.body.appendChild(a);
    var s = {};
    Object.keys(r).map(function (e) {
      var t = r[e];
      s[t.proportion] = t.color;
    });
    var l = _i.a.create({
        container: a,
        radius: n,
        opacity: 0.8,
        blur: 1,
        gradient: o({}, s),
        useGradientOpacity: !0
      }),
      u = {
        max: i,
        data: this.data.map(function (t) {
          var n = e.srcLnglatToWorld([t.lng, t.lat]);
          return {
            x: Math.round(n.x + e.heatWidth / 2),
            y: Math.round(-n.y + e.heatHeight / 2),
            value: t.value
          };
        })
      };
    l.setData(u);
    var c = a.childNodes[0],
      h = new y.Texture(c);
    h.needsUpdate = !0;
    var p = new y.MeshBasicMaterial({
      map: h,
      depthTest: !1,
      depthWrite: !1,
      transparent: !0
    });
    return document.body.removeChild(a), (a = null), p;
  }
  update() {}
  updateComponent(e) {
    var t = this.config,
      n = this.data,
      i = t.heatConfig;
    (this.config = e.configuration.joinHeat), (this.data = e.data);
    var r = this.config.heatConfig;
    (Object(x.isEqual)(n, this.data) && Object(x.isEqual)(i, r)) ||
      (this.disposeHeatPlane(), this.initHeatPlane());
  }
  updateMapLevel(e) {
    this.group.visible = 0 == e;
  }
  destroy() {
    this.disposeHeatPlane(), this.group.parent.remove(this.group), (this.group = null);
  }
}
class mapPath {
  constructor(e, i) {
    this.type = 'areaHeat';
    this.context = i.context;
    this.parentWidth = i.parentProps.width;
    this.parentHeight = i.parentProps.height;
    this.geometryList = [];
    this.refresh(e, i);
  }
  refresh(e, t) {
    this.mapGroup = t.mapGroup;
    this.props = e;
    var n = e.data;
    i = e.configuration;
    this.config = i.mapPath;
    this.data = n;
    this.group = new y.Group();
    this.mapGroup.add(this.group);
    var r = this.config.lineStyle;
    var a = r.color;
    var o = r.width;
    this.material = new y.LineMaterial({
      color: a,
      linewidth: o
    });
    this.material.resolution.set(this.parentWidth, this.parentHeight);
    var s = this.parseData();
    if (s) {
      for (var i = 0; i < s.length; i++) {
        this.drawLine(s[i]);
      }
    }
  }
  updateComponent(e, t) {
    var n = e.configuration.mapPath,
      i = e.data;
    (JSON.stringify(n) === JSON.stringify(this.config) &&
      JSON.stringify(i) === JSON.stringify(this.data)) ||
      (this.destroy(), this.refresh(e, t));
  }
  destroy() {
    this.material.dispose(),
      this.geometryList.forEach(function (e) {
        return e.dispose();
      }),
      (this.geometryList = []),
      (this.group.children = []);
  }
  parseData() {
    var e = [];
    if (this.data) {
      for (var i = 0; i < this.data.length; i++) {
        var v = this.data[t].value;
        e.push(this.lnglatToPosition(v));
      }
    }
    return e;
  }
  lnglatToPosition(e) {
    var n = [];
    var t = this.context.config.chart.mainMapConfig.height;
    if (e) {
      var i,
        r = Object(m.a)(e);
      try {
        for (r.s(); !(i = r.n()).done; ) {
          var a = i.value;
          var o = this.context.srcLnglatToWorld([a.lng, a.lat]);
          n.push(o.x, t + 2, -o.y);
        }
      } catch (e) {
        r.e(e);
      } finally {
        r.f();
      }
    }
    return n;
  }
  drawLine(e) {
    if (e && e.length) {
      var t = new y.LineGeometry();
      t.setPositions(e);
      this.geometryList.push(t);
      var n = new y.Line2(t, this.material);
      this.group.add(n);
    }
  }
}
